import React, { Component } from 'react';
import RouterView from '../../router/routerView'
import { NavLink } from 'react-router-dom'
import './style.scss'
class Index extends Component {
  render() {
    // 获取二级路由表
    const { routes } = this.props
    return (
      <div className="home">
        <div className="main">
          {/* 渲染二级路由视图 */}
          <RouterView routes={routes}></RouterView>
        </div>
        <div className="footer">
          {/* 渲染二级路由导航 */}
          {
            routes.length > 0 && routes.map((v, i) => {
              return (
                v.path && <NavLink to={v.path} key={i}>{v.name}</NavLink>
              )
            })
          }
        </div>
      </div>
    );
  }
}

export default Index;
